package com.kazusa.myservlet;

import jakarta.servlet.ServletException;
import jakarta.servlet.annotation.WebServlet;
import jakarta.servlet.http.HttpServlet;
import jakarta.servlet.http.HttpServletRequest;
import jakarta.servlet.http.HttpServletResponse;

import java.io.IOException;


/*
* 重定向：服务端指导，客户端的行为
* 存在两次行为,两次请求
* request对象不共享
* 地址栏不改变
*
*
* */
@WebServlet("/responseRedirect")
public class ResponseRedirect extends HttpServlet {
    @Override
    protected void service(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
        System.out.println("responseRedirect");
        //接受参数
        String uname=request.getParameter("uname");
        System.out.println("Redirect uname="+uname);
        //重定向跳转到s05
       response.sendRedirect("responseRedirectTool");
    }
}
